//
//  YGResetPwdViewController.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/3/18.
//

#import "YGResetPwdViewController.h"

@interface YGResetPwdViewController ()

@property (nonatomic, strong) UILabel *pwdLable;          //新密码
@property(nonatomic, strong) UILabel *confirmPwdLable;    //确认密码
@property (nonatomic, strong) UITextField *pwdTextField;        //密码框
@property (nonatomic, strong) UITextField *confirmPwdTextField;     //密码确认框
@property(nonatomic,strong) UIView *underLine;               //下划线
@property (nonatomic, strong) UIView *underLine2;            //下划线
@property (nonatomic, strong) UIButton *resetPwdBtn;            //重置密码按钮



@end

@implementation YGResetPwdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"重置密码";
    [self initView];
    [self initContraints];
    // Do any additional setup after loading the view.
}

#pragma private
- (void)initView{
    [self.view addSubview:self.pwdLable];
    [self.view addSubview:self.confirmPwdLable];
    [self.view addSubview:self.pwdTextField];
    [self.view addSubview:self.confirmPwdTextField];
    [self.view addSubview:self.resetPwdBtn];
    [self.view addSubview:self.underLine];
    [self.view addSubview:self.underLine2];
}

-(void)initContraints{
    [self.pwdLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view.mas_left).offset(10);
        make.top.mas_equalTo(self.view.mas_top).offset(100);
        make.width.mas_equalTo(88);
        make.height.mas_equalTo(30);
    }];
    
    [self.confirmPwdLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view.mas_left).offset(10);
        make.top.mas_equalTo(self.underLine.mas_bottom).offset(10);
        make.width.mas_equalTo(88);
        make.height.mas_equalTo(30);
    }];
    
    [self.pwdTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.pwdLable.mas_right).offset(10);
        make.top.mas_equalTo(self.pwdLable.mas_top);
        make.width.mas_offset(200);
        make.height.mas_equalTo(30);
    }];
    
    [self.confirmPwdTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.confirmPwdLable.mas_right).offset(10);
        make.top.mas_equalTo(self.confirmPwdLable.mas_top);
        make.width.mas_offset(200);
        make.height.mas_equalTo(30);
    }];
    
    [self.underLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0.5);
        make.top.mas_equalTo(self.pwdLable.mas_bottom).offset(4);
        make.right.mas_equalTo(self.view.mas_right).offset(-1);
        make.height.mas_equalTo(1);
    }];
    
    [self.underLine2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0.5);
        make.top.mas_equalTo(self.confirmPwdLable.mas_bottom).offset(4);
        make.right.mas_equalTo(self.view.mas_right).offset(-1);
        make.height.mas_equalTo(1);
    }];
    
    [self.resetPwdBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.underLine2.mas_bottom).offset(40);
        make.left.mas_equalTo(self.view.mas_left).offset(10);
        make.right.mas_equalTo(self.view.mas_right).offset(-10);
        make.height.mas_equalTo(50);
            
    }];
    
}

-(void)clickResetPwdAction{
    //修改个人密码
}

#pragma  setter

- (UILabel *)pwdLable{
    if (!_pwdLable) {
        _pwdLable = [[UILabel alloc] init];
        _pwdLable.text=@"新密码：";
        _pwdLable.font=[UIFont systemFontOfSize:14];
        _pwdLable.textColor=UIColorFromRGB(0x888888);
        
        
    }
    return _pwdLable;
}

- (UITextField *)pwdTextField{
    if (!_pwdTextField) {
        _pwdTextField= [[UITextField alloc] init];
        _pwdTextField.font= [UIFont systemFontOfSize:14];
        _pwdTextField.placeholder=@"6-16位字母、数字或符号组合";
        _pwdTextField.layer.borderWidth=0;
        _pwdTextField.textAlignment=NSTextAlignmentLeft;
        _pwdTextField.delegate=self;
//        [_phoneTextfield addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
        
    }
    return _pwdTextField;
}

- (UILabel *)confirmPwdLable{
    if (!_confirmPwdLable) {
        _confirmPwdLable= [[UILabel alloc] init];
        _confirmPwdLable.text=@"确认新密码：";
        _confirmPwdLable.font= [UIFont systemFontOfSize:14];
        _confirmPwdLable.textColor=UIColorFromRGB(0x888888);
        
    }
    return _confirmPwdLable;
}

- (UITextField *)confirmPwdTextField{
    if (!_confirmPwdTextField) {
        _confirmPwdTextField= [[UITextField alloc] init];
        _confirmPwdTextField.font= [UIFont systemFontOfSize:14];
        _confirmPwdTextField.placeholder=@"6-16位字母、数字或符号组合";
        _confirmPwdTextField.layer.borderWidth=0;
        _confirmPwdTextField.textAlignment=NSTextAlignmentLeft;
        _confirmPwdTextField.delegate=self;
//        [_codeTextfield addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
    }
    return _confirmPwdTextField;
}

- (UIView *)underLine{
    if (!_underLine) {
        _underLine = [[UIView alloc] init];
        _underLine.backgroundColor = UIColorFromRGB(0xf5f5f5);
    }
    return _underLine;
}

- (UIView *)underLine2{
    if (!_underLine2) {
        _underLine2 = [[UIView alloc] init];
        _underLine2.backgroundColor = UIColorFromRGB(0xf5f5f5);
    }
    return _underLine2;
}



- (UIButton *)resetPwdBtn{
    if (!_resetPwdBtn) {
        _resetPwdBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_resetPwdBtn addTarget:self action:@selector(clickResetPwdAction) forControlEvents:UIControlEventTouchUpInside];
        [_resetPwdBtn setTitle:@"重置密码" forState:UIControlStateNormal];
        _resetPwdBtn.titleLabel.font=[UIFont systemFontOfSize:16];
        _resetPwdBtn.layer.cornerRadius = 4;
        _resetPwdBtn.clipsToBounds = YES;
        _resetPwdBtn.backgroundColor = UIColorFromRGB(0x37C8D7);
    }
    return _resetPwdBtn;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
